with open('test.txt') as f:
    for line in f:
        print(line,end="")
#查看文件是否关闭,关闭了，输出True
print(f.closed)